<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('【请填写功能名称】列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">车辆用油支出</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId" >
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <label>充值时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginMTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endMTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12" style="background: white;margin-top: 10px"th:object="${mainGasoline}" >
                <div class="col-sm-4" style="margin-top: 15px" >

                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            主油卡总充值费用：
                        </div>
                        <div class="panel-body">
                            <h3 style="display: inline">￥</h3>
                            <input th:field="*{mTopup}" type="text" disabled="disabled" style="border:none; background: white; font-size: 20px; color: black" value="0"/>
                        </div>
                    </div>
                </div>
                <div class="col-sm-4" style="margin-top: 15px">
                    <div class="panel panel-info">
                        <div class="panel-heading">
                            主油卡余额：
                        </div>
                        <div class="panel-body">
                            <h3 style="display: inline">￥</h3>
                            <input th:field="*{mMoney}" type="text" disabled="disabled" style="border:none; background: white; font-size: 20px; color: black" value="￥0"/>
                        </div>
                    </div>
                </div>
                <div>
                    <button type="button" class="btn btn-info  dim btn-large-dim btn-outline" style=" width: 250px; height: 95px; font-size: 30px; margin-left: 20px; margin-top: 15px; font-family: 仿宋" onclick="childcard()">
                        查看副油卡支出</button>
                </div>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:oilcard:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <!-- <button type="button" class="btn btn-success" onclick="childcard()">查看副油卡支出</button> -->
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
    <script th:inline="javascript">
        var prefix = ctx + "ruoyi/oilcard";
        var prefixs = ctx + "ruoyi/childcard";
        function childcard(){
            var url = prefixs + '/childcard';
            // $.modal.open("查看副油卡", url,"1100","700");
            $.modal.openTab("车辆副油卡支出", url);
        }
        $(function() {
            var options = {
                url: prefix + "/lists",
                exportUrl:prefix + "/export",
                showFooter: true,
                showColumns:false,
                sortName:'mTime', //排序列名称
                sortOrder:'desc', //排序方式 asc/desc
                striped: true,
                modalName:"主油卡支出",
                columns: [
                {
                    field: 'mId', 
                    title: '主油卡id',
                    visible: false
                },
                {
                    field: 'mNumber', 
                    title: '主油卡卡号'

                },
                //{
                    // field: 'mMoney',
                    // title: '主油卡余额',
                    // footerFormatter: function(value){
                    //     var sum = 0;
                    //     for (var i in value) {
                    //         sum += parseFloat(value[i].mMoney)
                    //     }
                    //     return "主油卡总充值费用: "+sum;
                    // }
                //},
                    {
                        //field: 'mTopup',
                        title: '主油卡充值金额',
                        formatter:function(value, row, index){
                            var actions = [];
                            actions.push('￥'+row.mTopup);

                            return actions.join('');
                        },
                        footerFormatter: function(value){
                            var sum = 0;
                            for (var i in value) {
                                sum += parseFloat(value[i].mTopup)
                            }
                            return "主油卡总充值费用: ￥"+sum;
                        }
                    },
                {
                    field: 'mTime', 
                    title: '充值时间',
                    sortable: true, //排序
                },
                {
                    field: 'mRemark', 
                    title: '备注'
                }
                //,
                // {
                //     title: '操作',
                //     align: 'center',
                //     // formatter: function(value, row, index) {
                //     //     var actions = [];
                //     //     actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //     //     actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                //     //     return actions.join('');
                //     // }
                // }
                ]
            };
            $.table.init(options);
        });

    </script>
</body>
</html>